<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 一元运算符
    let num1 = 1;
    num1 = num1 + 1;
    console.log(num1);

    let num2 = 2;
    num2 += 2;
    console.log(num2);

    let num3 = 2;
    num3 *= 2;
    console.log(num3);

    let num4 = 2;
    num4 /= 2;
    console.log(num4);

    let num5 = 2;
    num5 %= 2;
    console.log(num5);

    // 二元运算符
    let num6 = 10 + 20;
    console.log(num6);

    // 自增运算  单独使用没区别，参与运算方才需要格外注意
    //前自增 先赋值在运算
    let num7 = 1;
    console.log(++num7);
    //后自增 先运算再赋值
    let num8 = 1;
    console.log(num8++);

    // 自减运算同理

    // 面试题
    let num9 = 1;
    //             1          3       3     =   7
    console.log(num9++ + ++num9 + num9);
  </script>
</body>

</html>